package com.zsk.shop.controller.app;

import com.zsk.shop.common.annotion.NoPermission;
import com.zsk.shop.common.base.BaseResponse;
import com.zsk.shop.model.results.AppUserDecodeResult;
import com.zsk.shop.service.AppleDecodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ljh
 */
@RestController
@Api(tags = "授权相关")
@RequestMapping("/app/grant")
public class GrantController {

    private static final Logger logger = LoggerFactory.getLogger(GrantController.class);

    @Autowired
    private AppleDecodeService appleDecodeService;

    /**
     * iOS appleid 授权登录
     *
     * @param identityToken
     * @return
     */
    @NoPermission
    @ApiOperation(value = "苹果移动端授权登录")
    @GetMapping(value = "/apple/decode.do")
    @ApiImplicitParam(name = "identityToken", value = "identityToken")
    public BaseResponse<AppUserDecodeResult> appleLogin(String identityToken) {
        return appleDecodeService.appleDecode(identityToken);
    }

}
